/**
 * @author OSEA
 * */
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;


public class MyServer {
	private ServerSocket serverSocket = null;
	private Socket clientSocket = null;
	private int port = 1234;
	public MyServer() throws IOException{
		this.serverSocket = new ServerSocket(this.port);		
	}
	public void startListen(){		
		try {
			clientSocket = this.serverSocket.accept();
		} catch (IOException e) {
			System.out.println("accept failed");
			System.exit(-1);
		}
		System.out.println("message from Server, success");
	}
	public void finish() throws IOException{
		this.serverSocket.close();
		this.clientSocket.close();
	}
	public static void main(String[] args) {
		try {
			MyServer program = new MyServer();
			program.startListen();
			program.finish();
		} catch (IOException e) {
			System.exit(-1);
		}
	}
}
